Binary - colour images part 2

Now it’s time to see what happens if we create images with millions of colours!

Back to part 1

In the example below we can select the colour of each pixel by using the sliders to mix red, green and blue. Each colour can have a value between 0 and 255 (8 bits or 1 byte). This means each pixel can have 256 x 256 x 256 colours, or in total over 16.7 million colours. Notice how the total binary size is a lot bigger than our previous examples.

R:
G:
B:

Binary output:

There are lots of different ways of storing images, and some use compression to make the amount of storage (the number of required bits) a lot smaller. JPEG images are a very popular way of storing compressed images. JPEGs allow you to choose how much you want to compress a file. The more you compress a JPEG the smaller its file size gets, but the image starts to degrade in quality. An interest article that takes a deep dive into JPEGs can be found at https://parametric.press/issue-01/unraveling-the-jpeg/

Summary

These series of blog posts were intended as a brief introduction to binary and how it can represent characters and images. It started with my 7 & 9 year olds wanting to know more about binary as a result of seeing 1s and 0s on a Lego minifigure.

But how much do you need to know about binary if you are a software developer. Well first and foremost it important to have a general understanding of binary so you know the basics and know the considerations to take into account when you come across them. In my 20+ years in software development it has only been in the last couple of years I’ve had to worry about binary in any depth.

On this recent project I am sending and receiving messages via satellite to devices in remote parts of the world. Sending these messages is expensive so we have to be careful with every bit and byte we send. Each message allows for up to 50 bytes, but even with this limitation it’s possible to pack a lot of data in that can provide a wealth of information and functionality.

Alex Orpwood Written by:

Software developing and architecting for 20 years. Satellite monitoring by day, writing my own app by night. More about me